// var local = "http://192.168.185.122:18081";
var local = "http://47.92.67.168:18081";
var mask = mui.createMask(); 
/**
 * 聊天记录
 * @param {Object} userOpenId
 * @param {Object} species
 * @param {Object} callback
 */
function getRedisMessageList(channelNum,token, callback) {
					callback = callback || $.noop;
					mui.ajax(app.getUrl() + 'userinfo/getRedisMessageList?token='+token, {
						data: {
							channelNum: channelNum
						},
						dataType: 'json', //服务器返回json格式数据
						type: 'post', //HTTP请求类型
						timeout: 10000, //超时时间设置为10秒；
						contentType: "application/json;charset=utf-8",
						async: false,
						beforeSend: function() {
							plus.nativeUI.showWaiting("正在连接世界...", "options");
							mask.show();

						},
						complete: function() {
							plus.nativeUI.closeWaiting();
							mask.close(); //关闭遮罩层
						},
						success: function(data) {
							if (data.errCode === "000000") {
								
								return callback(data.data);
							} else {
								plus.nativeUI.toast('出现错误:'+data.errMsg);
								return callback(null);
							}
						},
						error: function(xhr, type, errorThrown) {
							plus.nativeUI.toast('与服务器断开连接');
							return callback(null);
						}
					});
				}
				
function closeAll() {
	var views = plus.webview.all();
	var login = plus.webview.getWebviewById("/page/login.html");
	var html = '/page/login.html';
	w = plus.webview.create(html, html, {
		hardwareAccelerated: true,
		scrollIndicator: 'none', 
		scalable: true,
		bounce: 'all'
	});
	w.show('pop-in');
	for (var i = 0; i < views.length; i++) 
	{   
		console.log(JSON.stringify(views[i]))
		if (views[i] == login) {
			continue;
		} else {
			views[i].close();
		}
	}
}

